package com.company.test17;

import javax.swing.*;
import java.awt.*;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;

/**
 * Created by Administrator on 2016.9.19.
 */
public class Test17_10 extends JFrame {
    private JScrollBar jscbHort=new JScrollBar(JScrollBar.HORIZONTAL);
    private JScrollBar jscbVert=new JScrollBar(JScrollBar.VERTICAL);

    private Test1701.MessagePanel messagePanel=new Test1701.MessagePanel();

    public static void main(String[] args){
        Test17_10 frame=new Test17_10();
        frame.setTitle("bkb");
        frame.setLocationRelativeTo(null);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);
    }

    public Test17_10(){
        setLayout(new BorderLayout());
        add(messagePanel,BorderLayout.CENTER);
        add(jscbVert,BorderLayout.EAST);
        add(jscbHort,BorderLayout.SOUTH);

        jscbHort.addAdjustmentListener(new AdjustmentListener() {
            @Override
            public void adjustmentValueChanged(AdjustmentEvent e) {
                double value=jscbHort.getValue();
                double maximumValue=jscbHort.getMaximum();
                double newX=(value*messagePanel.getWidth()/maximumValue);
            }
        });
    }
}